{template 'common/header'}
<style>
	.main{
		margin: 0 0 30px 0;
	}
</style>
{if $op=='index'}
<div class="main">
	<div class="panel panel-default">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="../index.php" method="get" class="form-inline" role="form">
				<input type="hidden" name="c" value="site" />
	            <input type="hidden" name="a" value="entry" />
	            <input type="hidden" name="m" value="lanye_wd" />
	            <input type="hidden" name="do" value="netloan" />
	            <input type="hidden" name="op" value="index" />
				<div class="form-group">
					<label for="mobile">办理网贷</label>
					<select name="lend">
						<option value="0" {if $lend == 0}selected{/if}>全部网贷</option>
						{loop $lend $row}
						<option value="{$row['id']}" {if $row['id'] == $bank}selected{/if}>{$row['title']}</option>
						{/loop}
					</select>
				</div>
				<div class="form-group">
					<label for="mobile">手机号码</label>
					<input class="form-control" name="mobile" placeholder="请输入手机号码" type="text" value="{$mobile}">
				</div>
				<div class="form-group">
					<label for="name">真实姓名</label>
					<input type="text" name="username" class="form-control"  placeholder="请输入真实姓名" value="{$username}" />
				</div>
				<button type="submit" class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
	            
			</form>
		</div>
	</div>

    <div class="panel panel-default" style="margin-top: 15px;">	
        <div class="table-responsive panel-body">
            <form action="" method="post" class="form-horizontal form" onsubmit="return formcheck(this)">
                <table class="table table-hover" style="margin-top: 15px;">
                    <thead class="navbar-inner">
                    <tr>
                        <th class="text-center">记录ID</th>
                        <th class="text-center" >用户名称</th>
                      	<th class="text-center">手机号</th>
                      	<th class="text-center">身份证号</th>
                        <th class="text-center">网贷名称</th>
                        <th class="text-center">返佣总额</th>
                        <th class="text-center">第一级</th>
                        <th class="text-center">第二级</th>
                        <th class="text-center">第三级</th>
                        <th class="text-center">状态</th>
                        <th class="text-center">时间</th>
                        <th class="text-right"style="width: 100px;">操作</th>
                    </tr>
                    </thead>
                    <tbody id="level-list">
                    {loop $list $row}
                    <tr>
						<td class="text-center">
							{$row['id']}
						</td>
						<td class="text-center">
							{php echo $this->user($row['uid'])['name']}
						</td>
							
						<td>{php echo $this->user($row['uid'])['mobile']}</td>
						<td class="text-center">
							{php echo $this->user($row['uid'])['certify']}
						</td>
						<td class="text-center">
							<small>{php echo $this->lend($row['bank'])['title']}</small>
						</td>
						<td class="text-center">{$row['fan_total']}</td>
						<td class="text-center">
							{if $row['fan_uid1'] != 0}
							<small>{php echo $this->user($row['fan_uid1'])['name']}</small> <br />({$row['fan_level1']})
							{else}
							无
							{/if}
						</td>
						<td class="text-center">
							{if $row['fan_uid2'] != 0}
							<small>{php echo $this->user($row['fan_uid2'])['name']}</small> <br />({$row['fan_level2']})
							{else}
							无
							{/if}
						</td>
						<td class="text-center">
							{if $row['fan_uid3'] != 0}
							<small>{php echo $this->user($row['fan_uid3'])['name']}</small> <br />({$row['fan_level3']})
							{else}
							无
							{/if}
						</td>
						<td class="text-center">	
							{if $row['status'] ==1}
							<small class="label label-success">审核成功</small>
							{else if $row['status'] ==2}
							<small class="label label-default">审核失败</small>
							{else}
							<small class="label label-default">未审核</small>
							{/if}
						</td>
						<td class="text-center">
							<small>{php echo date('m-d H:i',$row['createtime'])}</small>
						</td>
                        <td style="text-align: right;">
                        	<?php  $percent_price=$this->lend($row['bank'])['percent_price'];?>
                        	{if $row['status']==0&&$row['status']!=2}
                        		{if $percent_price ==0}
                        			<a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('netloan', array('op' => 'confirm', 'id' => $row['id']))}" title="通过"><i class="fa fa-check"></i></a>
                        		{/if}
                        		{if $percent_price!=0}
                        			 <a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('netloan', array('op' => 'fencheng_confirm', 'id' => $row['id']))}" title="编辑"><i class="fa fa-pencil"></i></a>
                        		{/if}
                        	{/if}
                        	{if $row['status']==0&&$row['status']!=1}
                       		<a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('netloan', array('op' => 'reject', 'id' => $row['id']))}" title="驳回"><i class="fa fa-reply"></i></a>
                            {/if}
                        	{if  $row['status']!=0}
                            	-----
                            {/if}
                   
           <!--                  {if $row['status']==1}
               				<a class="btn btn-info btn-sm" href="{php echo $this->createWebUrl('netloan', array('op' => 'cancel', 'id' => $row['id']))}" title="撤回"><i class="fa fa-repeat"></i></a> -->
               	<!-- 			{/if}
                            <a class="btn btn-danger btn-sm" onclick="return confirm('是否要删除？');return false;" href="{php echo $this->createWebUrl('netloan', array('op' => 'delete', 'id' => $row['id']))}" title="删除"><i class="fa fa-times"></i></a> -->
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="10">
                            <input type="hidden" name="token" value="{$_W['token']}"/>
                        </td>
                    </tr>
                    </tbody>
                </table>
                
				<div class="pull-right">
					{$pager}
				</div>
                
            </form>
        </div>
    </div>
  
</div>
{/if}
{if $op == 'fencheng_confirm'}
<div class="main">
	<form action="" method="post" class="form-horizontal form" >
    <div class="panel panel-default">
        <div class="panel-heading">添加网贷下款额度</div>
        <div class="panel-body">   
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">下款额度</label>
                <div class="col-sm-9">
                    <input type="number" name="application_amount" class="form-control application_amount" value="{$card_record['application_amount']}" />
                </div>
            </div>  
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-12">
            <input name="submit" type="submit" value="提交" class="btn btn-primary ">
            <input type="hidden" name="token" value="{$_W['token']}"/>
			<input type="hidden" name="id" value="{$card_record['id']}"/>
			<input type="hidden" name="uid" value="{$card_record['uid']}"/>
			<input type="hidden" name="percent_price" value="{$card_lend['percent_price']}"/>

        </div>
    </div>
	</form>
</div>
<script>
require(['jquery', 'util'], function($, util){
    $(function(){
        $('form').submit(function(){
           var name=$(".application_amount").val();
            if(name==''||name==null||name==0){
                util.message('下款额度不能小于等于0');
                return false;
            }
        });

    });

});

</script>
{/if}
{template 'common/footer'}